﻿using JMS.IdentityModel.JWT.Authentication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace CheckIn.UserInfoHost.Applications
{
    public class AuthService
    {

        public string CreateToken(long userId,string openId)
        {
            Claim[] claims = new Claim[] {
                new Claim("userId", userId.ToString()),
                new Claim("openId", openId)
            };

      
            var expireTime = DateTime.Now.AddYears(1);

            //生成token
            var token = JwtHelper.GenerateToken(claims, Global.Configuration["JwtSecret"], expireTime);

            return token;
        }
    }
}
